#region Imports

using System;
using IEC.ColumnOrdering.SP2007.Application.Domain;

#endregion

namespace IEC.ColumnOrdering.SP2007.Application.Services
{

    /// <summary>
    /// Defines the functionality of column ordering services for SharePoint.
    /// </summary>
    public interface IColumnOrderingService
    {

        #region Methods - Instance Member
        
        /// <summary>
        /// Gets the applications in the SharePoint instance.
        /// </summary>
        /// <returns>
        /// The applications in the SharePoint instance.
        /// </returns>
        ApplicationCollection GetApplications();

        /// <summary>
        /// Gets the application context in current use.
        /// </summary>
        /// <returns>
        /// The application context in current use.
        /// </returns>
        Domain.Application GetApplication();

        /// <summary>
        /// Gets the application identified by the given identifier.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application to be retrieved.
        /// </param>
        /// <returns>
        /// The application identified by <paramref name="applicationId"/>.
        /// </returns>
        Domain.Application GetApplication(Guid applicationId);

        /// <summary>
        /// Gets the sites for the specified application.
        /// </summary>
        /// <param name="application">
        /// The application whose sites will be retrieved.
        /// </param>
        /// <returns>
        /// The sites owned by <paramref name="application"/>.
        /// </returns>
        SiteCollection GetSites(Domain.Application application);

        /// <summary>
        /// Gets the sites for the specified application identifier.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application whose sites will be retrieved.
        /// </param>
        /// <returns>
        /// The sites owned by the application identified by <paramref name="applicationId"/>.
        /// </returns>
        SiteCollection GetSites(Guid applicationId);

        /// <summary>
        /// Gets the site context in current use.
        /// </summary>
        /// <returns>
        /// The site context in current use.
        /// </returns>
        Site GetSite();

        /// <summary>
        /// Gets the site with the specified identifier, within the application identified
        /// by the given identifier.
        /// </summary>
        /// <param name="applicationId">
        /// The application identifier.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the application containing the site.
        /// </param>
        /// <returns>
        /// The site identified by <paramref name="siteId"/>, within the application identified
        /// by <paramref name="siteId"/>.
        /// </returns>
        Site GetSite(Guid applicationId, Guid siteId);

        /// <summary>
        /// Gets the lists for the given site, in the specified application.
        /// </summary>
        /// <param name="application">
        /// The application containing the site whose webs will be retrieved.
        /// </param>
        /// <param name="site">
        /// The site containing the web whose lists will be retrieved.
        /// </param>
        /// <returns>
        /// The webs owned by the specified site, in the specified application.
        /// </returns>
        WebCollection GetWebs(
            Domain.Application application,
            Site site);

        /// <summary>
        /// Gets the webs for the given site, in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the site whose webs will be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the web whose lists will be retrieved.
        /// </param>
        /// <returns>
        /// The webs owned by the specified site, in the specified application.
        /// </returns>
        WebCollection GetWebs(
            Guid applicationId, 
            Guid siteId);

        /// <summary>
        /// Gets the web for the specified site.
        /// </summary>
        /// <param name="site">
        /// The site whose webs will be retrieved.
        /// </param>
        /// <returns>
        /// The webs owned by <paramref name="site"/>.
        /// </returns>
        WebCollection GetWebs(Site site);

        /// <summary>
        /// Gets the web for the specified site identifier.
        /// </summary>
        /// <param name="siteId">
        /// The identifier of the site whose webs will be retrieved.
        /// </param>
        /// <returns>
        /// The webs owned by the site identified by <paramref name="siteId"/>.
        /// </returns>
        WebCollection GetWebs(Guid siteId);

        /// <summary>
        /// Gets web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the web to be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the web to be retrieved.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web to be retrieved.
        /// </param>
        /// <returns>
        /// The web in the specified site, in the specified application.
        /// </returns>
        Web GetWeb(
            Guid applicationId,
            Guid siteId,
            Guid webId);

        /// <summary>
        /// Gets the web context in current use.
        /// </summary>
        /// <returns>
        /// The web context in current use.
        /// </returns>
        Web GetWeb();

        /// <summary>
        /// Gets the lists for the given web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="application">
        /// The application containing the web whose lists will be retrieved.
        /// </param>
        /// <param name="site">
        /// The site containing the web whose lists will be retrieved.
        /// </param>
        /// <param name="web">
        /// The web containing the web whose lists will be retrieved.
        /// </param>
        /// <returns>
        /// The lists owned by the specified web, 
        /// in the specified site, in the specified application.
        /// </returns>
        ListCollection GetLists(
            Domain.Application application,
            Site site,
            Web web);

        /// <summary>
        /// Gets the views for the given web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the web whose lists will be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the web whose lists will be retrieved.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web containing the web whose lists will be retrieved.
        /// </param>
        /// <returns>
        /// The views owned by the specified web, 
        /// in the specified site, in the specified application.
        /// </returns>
        ListCollection GetLists(
            Guid applicationId,
            Guid siteId,
            Guid webId);

        /// <summary>
        /// Gets the lists for the specified web.
        /// </summary>
        /// <param name="web">
        /// The web whose lists will be retrieved.
        /// </param>
        /// <returns>
        /// The lists owned by <paramref name="web"/>.
        /// </returns>
        ListCollection GetLists(Web web);

        /// <summary>
        /// Gets the lists for the specified web identifier.
        /// </summary>
        /// <param name="webId">
        /// The identifier of the web whose lists will be retrieved.
        /// </param>
        /// <returns>
        /// The lists owned by the web identified by <paramref name="webId"/>.
        /// </returns>
        ListCollection GetLists(Guid webId);

        /// <summary>
        /// Gets the requested list in the specified web, in the specified site, 
        /// in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The application containing the list to be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The site containing the list to be retrieved.
        /// </param>
        /// <param name="webId">
        /// The web containing the list to be retrieved.
        /// </param>
        /// <returns>
        /// The list with the requested identifier, in the specified web, 
        /// in the specified site, in the specified application.
        /// </returns>
        List GetList(
            Guid applicationId,
            Guid siteId,
            Guid webId);

        /// <summary>
        /// Gets the specified list in the specified web, in the specified site, 
        /// in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The application containing the list to be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The site containing the list to be retrieved.
        /// </param>
        /// <param name="webId">
        /// The web containing the list to be retrieved.
        /// </param>
        /// <param name="listId">
        /// The list to be retrieved.
        /// </param>
        /// <returns>
        /// The list with the give identifier, in the specified web, 
        /// in the specified site, in the specified application.
        /// </returns>
        List GetList(
            Guid applicationId,
            Guid siteId,
            Guid webId,
            Guid listId);

        /// <summary>
        /// Gets the views for the given list, 
        /// in the specified web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="application">
        /// The application containing the list whose views will be retrieved.
        /// </param>
        /// <param name="site">
        /// The site containing the list whose views will be retrieved.
        /// </param>
        /// <param name="web">
        /// The web containing the list whose views will be retrieved.
        /// </param>
        /// <param name="list">
        /// The list whose views will be retrieved.
        /// </param>
        /// <returns>
        /// The views owned by the specified list, 
        /// in the specified web, in the specified site, in the specified application.
        /// </returns>
        ViewCollection GetViews(
            Domain.Application application,
            Site site,
            Web web, 
            List list);

        /// <summary>
        /// Gets the views for the given list, 
        /// in the specified web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the list whose views will be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the list whose views will be retrieved.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web containing the list whose views will be retrieved.
        /// </param>
        /// <param name="listId">
        /// The identifier of the list whose views will be retrieved.
        /// </param>
        /// <returns>
        /// The views owned by the specified list, 
        /// in the specified web, in the specified site, in the specified application.
        /// </returns>
        ViewCollection GetViews(
            Guid applicationId,
            Guid siteId,
            Guid webId,
            Guid listId);

        /// <summary>
        /// Gets the views for the specified list.
        /// </summary>
        /// <param name="list">
        /// The list whose views will be retrieved.
        /// </param>
        /// <returns>
        /// The views owned by <paramref name="list"/>.
        /// </returns>
        ViewCollection GetViews(List list);

        /// <summary>
        /// Gets the views for the specified list identifier.
        /// </summary>
        /// <param name="listId">
        /// The identifier of the list whose views will be retrieved.
        /// </param>
        /// <returns>
        /// The views owned by the list identified by <paramref name="listId"/>.
        /// </returns>
        ViewCollection GetViews(Guid listId);

        /// <summary>
        /// Gets the view with the specified identifier, for the given list, 
        /// in the specified web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the view to be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the view to be retrieved.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web containing the view to be retrieved.
        /// </param>
        /// <param name="listId">
        /// The identifier of the list containing the view to be retrieved.
        /// </param>
        /// <param name="viewId">
        /// The identifier of the view to be retrieved.
        /// </param>
        /// <returns>
        /// The view identified by <paramref name="viewId"/> in the specified list, 
        /// in the specified web, in the specified site, in the specified application.
        /// </returns>
        View GetView(
            Guid applicationId,
            Guid siteId,
            Guid webId,
            Guid listId,
            Guid viewId);

        /// <summary>
        /// Gets the fields for the specified list.
        /// </summary>
        /// <param name="list">
        /// The list owning the fields to be retrieved.
        /// </param>
        /// <returns>
        /// The fields owned by <paramref name="list"/>.
        /// </returns>
        FieldCollection GetFields(List list);

        /// <summary>
        /// Gets the fields in the given list, 
        /// in the specified web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the list whose fields are to be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the list whose fields are to be retrieved.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web containing the list whose fields are to be retrieved.
        /// </param>
        /// <param name="listId">
        /// The identifier of the list containing the fields to be retrieved.
        /// </param>
        /// <returns>
        /// The fields in the list identified by <paramref name="listId"/>, 
        /// in the specified web, in the specified site, in the specified application.
        /// </returns>
        FieldCollection GetFields(
            Guid applicationId,
            Guid siteId,
            Guid webId,
            Guid listId);

        /// <summary>
        /// Gets the fields in the given list, in the specified view,
        /// in the specified web, in the specified site, in the specified application.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the list whose fields are to be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the list whose fields are to be retrieved.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web containing the list whose fields are to be retrieved.
        /// </param>
        /// <param name="listId">
        /// The identifier of the list containing the fields to be retrieved.
        /// </param>
        /// <param name="viewId">
        /// The identifier of the view containing the fields to be retrieved.
        /// </param>
        /// <returns>
        /// The fields in the view identified by <paramref name="viewId"/>, in the specified list,
        /// in the specified web, in the specified site, in the specified application.
        /// </returns>
        FieldCollection GetFields(
            Guid applicationId,
            Guid siteId,
            Guid webId,
            Guid listId,
            Guid viewId);

        /// <summary>
        /// Gets the fields for the list identified by the given identifier.
        /// </summary>
        /// <param name="listId">
        /// The identifier of the list owning the fields to be retrieved.
        /// </param>
        /// <returns>
        /// The fields owned by the list identified by <paramref name="listId"/>.
        /// </returns>
        FieldCollection GetFields(Guid listId);

        /// <summary>
        /// Gets the fields for the specified list and view.
        /// </summary>
        /// <param name="list">
        /// The list owning the view whose fields will be retrieved.
        /// </param>
        /// <param name="view">
        /// The view whose fields will be retrieved.
        /// </param>
        /// <returns>
        /// The fields owned by <paramref name="view"/>.
        /// </returns>
        FieldCollection GetFields(List list, View view);

        /// <summary>
        /// Gets the fields for the specified list identifier and view identifier.
        /// </summary>
        /// <param name="listId">
        /// The identifier of the list owning the view identified by <paramref name="viewId"/>.
        /// </param>
        /// <param name="viewId">
        /// The identifier of the view whose fields will be retrieved.
        /// </param>
        /// <returns>
        /// The fields owned by the view identified by <paramref name="viewId"/>.
        /// </returns>
        FieldCollection GetFields(Guid listId, Guid viewId);

        /// <summary>
        /// Gets the fields for the specified list which are not included in the given view.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application owning the view identified 
        /// by <paramref name="viewId"/>.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site owning the view identified by <paramref name="viewId"/>.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web owning the view identified by <paramref name="viewId"/>.
        /// </param>
        /// <param name="listId">
        /// The identifier of the list owning the view identified by <paramref name="viewId"/>.
        /// </param>
        /// <param name="viewId">
        /// The identifier of the view containing the fields to be 'subtracted'.
        /// </param>
        /// <returns>
        /// The fields in the list identified by <paramref name="listId"/>,
        /// but included in the view identified by <paramref name="viewId"/>.
        /// </returns>
        FieldCollection GetFieldsInListNotIncludedInView(
            Guid applicationId, Guid siteId, Guid webId, Guid listId, Guid viewId);

        /// <summary>
        /// Updates the field order in the view identified by the specified identifiers.
        /// </summary>
        /// <param name="application">
        /// The application containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="site">
        /// The site containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="web">
        /// The web containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="list">
        /// The list containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="view">
        /// The view whose fields will be retrieved.
        /// </param>
        /// <param name="fields">
        /// The fields, in the new order.
        /// </param>
        void UpdateViewFieldOrder(
            Domain.Application application,
            Site site,
            Web web,
            List list,
            View view,
            FieldCollection fields);

        /// <summary>
        /// Updates the field order in the view identified by the specified identifiers.
        /// </summary>
        /// <param name="applicationId">
        /// The identifier of the application containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="siteId">
        /// The identifier of the site containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="webId">
        /// The identifier of the web containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="listId">
        /// The identifier of the list containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="viewId">
        /// The identifier of the view whose fields will be retrieved.
        /// </param>
        /// <param name="fields">
        /// The fields, in the new order.
        /// </param>
        void UpdateViewFieldOrder(
            Guid applicationId,
            Guid siteId,
            Guid webId,
            Guid listId,
            Guid viewId,
            FieldCollection fields);

        /// <summary>
        /// Updates the field order in the specified view, in the given list.
        /// </summary>
        /// <param name="list">
        /// The list containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="view">
        /// The view to be updated.
        /// </param>
        /// <param name="fields">
        /// The fields, in the new order.
        /// </param>
        void UpdateViewFieldOrder(List list, View view, FieldCollection fields);

        /// <summary>
        /// Updates the field order in the view identified by the specified identifiers.
        /// </summary>
        /// <param name="listId">
        /// The identifier of the list containing the view whose fields will be retrieved.
        /// </param>
        /// <param name="viewId">
        /// The identifier of the view whose fields will be retrieved.
        /// </param>
        /// <param name="fields">
        /// The fields, in the new order.
        /// </param>
        void UpdateViewFieldOrder(Guid listId, Guid viewId, FieldCollection fields);

        #endregion

    }

}
